﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using Htss.Platform.WebApi.Http;
using System.Web.Routing;

namespace DreamBox.Api
{
    public class Global : System.Web.HttpApplication
    {
        private void RegisterRoute(RouteCollection routeCollection)
        {
            routeCollection.MapRouteBox("route4", "user/{box}",
                new { box = "portal" }, "user");

            routeCollection.MapRouteBox("route5", "talk/{box}",
                new { box = "portal" }, "talk");

            routeCollection.MapRouteBox("route6", "talk/{box}/{id}",
                new { box = "portal" }, "talk");

            routeCollection.MapRouteBox("route3", "posts/{box}",
                new { box = "portal" }, "posts");

            routeCollection.MapRouteBox("route7", "posts/{box}/{id}",
                new { box = "portal" }, "posts");

            routeCollection.MapRouteBox("route8", "posts/{box}/{id}/{p}",
                new { box = "portal" }, "posts");

            routeCollection.MapRouteBox("route2", "{box}/{id}",
                new { box = "portal", id = 0 });

            routeCollection.MapRouteBox("route1", "{box}",

                new { box = "portal" });

            routeCollection.MapRouteBox("default", "",
                new { box = "portal" });

        }
        protected void Application_Start(object sender, EventArgs e)
        {
            //注册路由
            RegisterRoute(RouteTable.Routes);
        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}